package com.gamebox.util;

import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.SQLException;

public class DBDriver {
	public static Connection getConnection() {
		Connection connection = null;

		try {
			Class.forName("com.mysql.jdbc.Driver");
		} catch (ClassNotFoundException e) {
			System.out.println("Can't find MySQL JDBC Driver?");
			e.printStackTrace();
			return connection;
		}

		System.out.println("MySQL JDBC Driver Registered!");

		try {
			connection = DriverManager.getConnection(
					"jdbc:mysql://localhost:3306/gamebox?useUnicode=true&characterEncoding=utf8", "root", "");

		} catch (SQLException e) {
			System.out.println("Connection Failed! Check output console");
			e.printStackTrace();
			connection = null;
		}
		return connection;
	}
	
}
